package com.yixing.tech.entity.entity.attr;

import com.yixing.tech.common.base.BusinessException;
import com.yixing.tech.entity.entity.RequestType;
import com.yixing.tech.common.vo.s5.EntitySchema;
import org.springframework.data.mongodb.core.aggregation.Aggregation;
import org.springframework.data.mongodb.core.aggregation.AggregationOperation;

import java.util.List;

/**
 * @author yixing tech
 * at 2021/10/9
 * describe：
 */
public final class ObjList extends AttrType {
    public ObjList() {
        super("对象列表", "objList");
    }

    @Override
    public void out(List<AggregationOperation> operations, EntitySchema.AttrVO attr, RequestType requestType) throws BusinessException {
        if(requestType == RequestType.SIMPLE){
            operations.add(Aggregation.project().andExclude(attr.getCode()));
        }
    }
}
